home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 175 (1991-09-10)(Manewaldt, A.)(DE)(PD).zip / Taifun 175 (1991-09-10)(Manewaldt, A.)(DE)(PD).adf / Term / Libs.LZH / XprXModem / xprxmodem.h < prev    next >
C/C++ Source or Header  |  1991-07-26  |  5KB  |  158 lines

  1. /** xproto.h
  2. *
  3. *   Include file for External Protocol Handling
  4. *
  5. **/
  6.  
  7. /*
  8.  * The structure
  9.  */
  10. struct XPR_IO {
  11.     char *xpr_filename;    /* File name(s)             */
  12.     long (*xpr_fopen) ();    /* Open file                */
  13.     long (*xpr_fclose) ();    /* Close file               */
  14.     long (*xpr_fread) ();    /* Get char from file       */
  15.     long (*xpr_fwrite) ();    /* Put string to file       */
  16.     long (*xpr_sread) ();    /* Get char from serial     */
  17.     long (*xpr_swrite) ();    /* Put string to serial     */
  18.     long (*xpr_sflush) ();    /* Flush serial input buffer */
  19.     long (*xpr_update) ();    /* Print stuff              */
  20.     long (*xpr_chkabort) (void);    /* Check for abort          */
  21.     long (*xpr_chkmisc) ();    /* Check misc. stuff        */
  22.     long (*xpr_gets) ();    /* Get string interactively */
  23.     long (*xpr_setserial) ();    /* Set and Get serial info  */
  24.     long (*xpr_ffirst) ();    /* Find first file name     */
  25.     long (*xpr_fnext) ();    /* Find next file name      */
  26.     long (*xpr_finfo) ();    /* Return file info         */
  27.     long (*xpr_fseek) ();    /* Seek in a file           */
  28.     long xpr_extension;    /* Number of extensions     */
  29.     struct XProtocolData *xpr_data;    /* Initialized by Setup.    */
  30.     long (*xpr_options) ();    /* Multiple XPR options.    */
  31.     long (*xpr_unlink) ();    /* Delete a file.           */
  32.     long (*xpr_squery) ();    /* Query serial device      */
  33.     long (*xpr_getptr) ();    /* Get various host ptrs    */
  34. };
  35.  
  36. /*
  37.  * Number of defined extensions
  38.  */
  39. #define XPR_EXTENSION 4L
  40.  
  41. /*
  42.  * Flags returned by XProtocolSetup()
  43.  */
  44. #define XPRS_FAILURE    0x00000000L
  45. #define XPRS_SUCCESS    0x00000001L
  46. #define XPRS_NORECREQ   0x00000002L
  47. #define XPRS_NOSNDREQ   0x00000004L
  48. #define XPRS_HOSTMON    0x00000008L
  49. #define XPRS_USERMON    0x00000010L
  50. #define XPRS_HOSTNOWAIT 0x00000020L
  51.  
  52. /*
  53.  * The update structure
  54.  */
  55. struct XPR_UPDATE {
  56.     long xpru_updatemask;
  57.     char *xpru_protocol;
  58.     char *xpru_filename;
  59.     long xpru_filesize;
  60.     char *xpru_msg;
  61.     char *xpru_errormsg;
  62.     long xpru_blocks;
  63.     long xpru_blocksize;
  64.     long xpru_bytes;
  65.     long xpru_errors;
  66.     long xpru_timeouts;
  67.     long xpru_packettype;
  68.     long xpru_packetdelay;
  69.     long xpru_chardelay;
  70.     char *xpru_blockcheck;
  71.     char *xpru_expecttime;
  72.     char *xpru_elapsedtime;
  73.     long xpru_datarate;
  74.     long xpru_reserved1;
  75.     long xpru_reserved2;
  76.     long xpru_reserved3;
  77.     long xpru_reserved4;
  78.     long xpru_reserved5;
  79. };
  80.  
  81. /*
  82.  * The possible bit values for the xpru_updatemask are:
  83.  */
  84. #define XPRU_PROTOCOL           0x00000001L
  85. #define XPRU_FILENAME           0x00000002L
  86. #define XPRU_FILESIZE           0x00000004L
  87. #define XPRU_MSG                0x00000008L
  88. #define XPRU_ERRORMSG           0x00000010L
  89. #define XPRU_BLOCKS             0x00000020L
  90. #define XPRU_BLOCKSIZE          0x00000040L
  91. #define XPRU_BYTES              0x00000080L
  92. #define XPRU_ERRORS             0x00000100L
  93. #define XPRU_TIMEOUTS           0x00000200L
  94. #define XPRU_PACKETTYPE         0x00000400L
  95. #define XPRU_PACKETDELAY        0x00000800L
  96. #define XPRU_CHARDELAY          0x00001000L
  97. #define XPRU_BLOCKCHECK         0x00002000L
  98. #define XPRU_EXPECTTIME         0x00004000L
  99. #define XPRU_ELAPSEDTIME        0x00008000L
  100. #define XPRU_DATARATE           0x00010000L
  101.  
  102. /*
  103.  * The xpro_option structure
  104.  */
  105. struct xpr_option {
  106.     char *xpro_description;    /* description of the option                  */
  107.     long xpro_type;        /* type of option                             */
  108.     char *xpro_value;    /* pointer to a buffer with the current value */
  109.     long xpro_length;    /* buffer size                                */
  110. };
  111.  
  112. /*
  113.  * Valid values for xpro_type are:
  114.  */
  115. #define XPRO_BOOLEAN 1L        /* xpro_value is "yes", "no", "on" or "off"   */
  116. #define XPRO_LONG    2L        /* xpro_value is string representing a number */
  117. #define XPRO_STRING  3L        /* xpro_value is a string                     */
  118. #define XPRO_HEADER  4L        /* xpro_value is ignored                      */
  119. #define XPRO_COMMAND 5L        /* xpro_value is ignored                      */
  120. #define XPRO_COMMPAR 6L        /* xpro_value contains command parameters     */
  121.  
  122. #include    <exec/libraries.h>
  123.  
  124. #define    XPRXLIBNAME    "xprxmodem.library"
  125.  
  126. /* data message length */
  127. #define SMSGLEN 128        /* short message length */
  128. #define LMSGLEN 1024        /* long message length */
  129.  
  130. struct XProtocolBase {
  131.     struct Library xp_Lib;
  132.     unsigned long xp_SegList;
  133. };
  134.  
  135. struct XProtocolData {
  136.     long fp, serialbits;
  137.     int ascii, crc_conf, big;
  138.     int crcmode;        /* TRUE for CRC mode, FALSE for checksum */
  139.     long numerrs, numtime, startsecs, startmics, filsiz;
  140.     int savech, abort;
  141.     int blknum;        /* current block number */
  142.     int bufptr;        /* current buffer pointer */
  143.     int chksum;        /* current checksum value (or CRC) */
  144.     int msgstart;        /* current message start character (SOH or
  145.                  * STX) */
  146.     int msglength;        /* current message length */
  147.     int nak;        /* NAK character on receive */
  148.     unsigned char *buffer;    /* data portion of packet */
  149.     unsigned char packet[LMSGLEN + 5];
  150. };
  151.  
  152. long XProtocolCleanup(struct XPR_IO * IO);
  153. long XProtocolSetup(struct XPR_IO * IO);
  154. long XProtocolSend(struct XPR_IO * IO);
  155. long XProtocolReceive(struct XPR_IO * IO);
  156.  
  157. #include "xprxmodempragmas.h"
  158.